package de.g18.it0a.jlaser.dataio;

import java.io.IOException;
import java.text.MessageFormat;
import java.util.List;

import de.g18.it0a.jlaser.domain.Position;
import de.g18.it0a.jlaser.domain.RoomConfiguration;


public class RoomConfigurationEditor {

	private RoomConfiguration roomConfig;


	public RoomConfiguration getRoomConfiguration() {
		return roomConfig;
	}

	public void setRoomConfiguration(RoomConfiguration aRoomConfig) {
		roomConfig = aRoomConfig;
	}

	public void saveConfigFile(String aPath) throws IOException {
		RoomConfigurationWriter.write(roomConfig, aPath);
	}

	public boolean setVitrinesInRoomConfig(Position aNewVitrinesPoint) {
		List<Position> vitrineLocations = roomConfig.getVetrinePositions();
		return vitrineLocations.add(aNewVitrinesPoint);
	}

	public void listVitrinePositions(){
		System.out.println("An folgenden positionen befinden sich Vitrinen");
		for (Position position : roomConfig.getVetrinePositions()) {
			System.out.println(MessageFormat.format("X: {0}, Y: {1}", position.getX(), position.getY()));
		}
	}
}
